package com.example.demo.mapper;

import com.example.demo.pojo.Pets;
import com.example.demo.pojo.Seller;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SellerMapper {
	@Select("select * from seller where sellerID=#{sellerID}")
	List<Seller> findByID(Integer sellerID);

	@Select("select * from seller where sellerID=#{sellerID}")
	Seller selectByID(Integer sellerID);

	@Select("select * from seller")
	List<Seller> findAll();

	@Select("<script>" +
			"SELECT * FROM seller WHERE sellerID IN " +
			"<foreach item='item' index='index' collection='sellerIDs' open='(' separator=',' close=')'>" +
			"#{item}" +
			"</foreach>" +
			"</script>")
	List<Seller> findSellersByIDs(@Param("sellerIDs") List<Integer> sellerIDs);
	@Select("SELECT g.*, s.* FROM pets g JOIN seller s ON g.sellerID = s.sellerID WHERE g.sellerID = #{sellerID}")
	List<Seller> findBygoodsID(Integer goodsID);
}
